﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace SMS_Gateway
{
    abstract public class Gateway
    {
        protected string _senderID;

        public string SenderID
        {
            get
            {
                return _senderID;
            }
            set
            {
                if (!String.IsNullOrEmpty(_senderID))
                {
                    _senderID = value;
                }
            }
        }

        public abstract bool SendSingleSMSTo(Credentials cred, SingleSMS sms, SMSContact cont, bool unicode);

        public abstract bool IsConnected { get; }

        public Gateway(String senderID )
        {
            this._senderID = senderID;
        }



        // May be needed by some services
        protected string EncodeTo4DigitHex(String inputStr)
        {
            // OK , so this the way i came up with to put in 4-digit hex format... see manual
            char[] _smsbodyinbytes = inputStr.ToCharArray();
            string[] _smsbodyinintsString = Array.ConvertAll<char, string>(_smsbodyinbytes, (x) => ((int)x).ToString("x4"));
            string _hexencodedString = string.Concat(_smsbodyinintsString);
            // -------------------------------------------------------------------------
            return _hexencodedString;
        }

    }
    


}
